package main

import (
	"github.com/spf13/viper"
)

func InitConfig() {
	viper.SetConfigName("config")
	viper.SetConfigType("yaml")
	viper.AddConfigPath(".")

	viper.SetDefault("endpoint.ssl", "ssl.tencentcloudapi.com")
	viper.SetDefault("endpoint.dns", "dnspod.tencentcloudapi.com")
	viper.SetDefault("email", "hotcoffie@163.com")
	viper.SetDefault("diff-days-limit", 10)
	viper.SetDefault("timeout", 60)
	viper.SetDefault("nginx.cmd.test", "nginx -t")
	viper.SetDefault("nginx.cmd.test", "nginx -s reload")
	viper.SetDefault("nginx.root", "/etc/nginx")
	viper.SetDefault("nginx.config-file", "./nginx.conf")

	err := viper.ReadInConfig()
	if err != nil {
		logger.Panic("Fatal error config file: ", err)
	}
}
